<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
%>
<!DOCTYPE HTML>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta http-equiv="pragma" content="no-cache" />
	<meta http-equiv="cache-control" content="no-cache"/>
	<meta http-equiv="expires" content="0" />
	<title>菜单管理</title>
	<link rel="stylesheet" href="<%=path %>/scripts/zTree/css/zTreeStyle/zTreeStyle.css" type="text/css" />
	
	<script type="text/javascript" src="<%=path %>/scripts/jquery/jquery-1.8.2.min.js"></script>
	<script type="text/javascript" src="<%=path %>/scripts/zTree/jquery.ztree.core-3.0.min.js"></script>
	<script type="text/javascript">
		$(function(){
			$.ajaxSetup({cache:false,async:false});
			var setting = {
				data: {
					simpleData: {
						enable: true
					}
				}
			};
			var dataMaker = function(){
				var nodes = [];
				var p = {id:"0",pId:"-1",name:"菜单管理",code:"0",url:"view?pid=0",target:"viewFrame",open:true,icon:"<%=path %>/scripts/zTree/css/zTreeStyle/img/diy/1_close.png"};
				nodes.push(p);
				$.getJSON("List?pid=0",function(result){
					if(result != null){
						$.each(result,function(i,item){
							var h = {id:item.id,pId:"0",name:item.menuName,code:item.id,url:"view?pid="+item.id,target:"viewFrame",open:true};
							nodes.push(h);
						});
					}
				});
				return nodes;
			};
			var zNodes = dataMaker();
			$(document).ready(function(){ 
				$.fn.zTree.init($("#menuTree"), setting, zNodes);
			});
		});
	</script>
</head>
<body>
	<div class="treebar"></div>
	<div class="content_wrap" >
		<ul id="menuTree" class="ztree"></ul>
	</div>
</body>
</html>